import { Inject, Provide } from '@midwayjs/core'
import { Context } from '@midwayjs/koa'

import { LoginUserService } from '@/service'

@Provide()
export class CommonService {
  @Inject()
  ctx: Context

  async handleGetUserInfo() {
    const loginUserService = await this.ctx.requestContext.getAsync(
      LoginUserService
    )

    return await loginUserService.getCurrentUser()
  }
}
